package com.bj58.migrate.condition.reader;

import java.io.File;

import com.bj58.migrate.condition.ConditionReader;
import com.bj58.migrate.helper.StringHelper;

/**
 * Created by lvzheng on 2014/8/8.
 */
public class SingleFileReader implements ConditionReader {

	@Override
	public File[] getConditionFileList(String[] args) {

		String filePath = "/opt/apps/app/avgsalary/now/";
		if( args != null && args.length >= 5 && !StringHelper.isEmpty( args[ 4 ] ) ){
			filePath = "/opt/apps/app/avgsalary/" + args[ 4 ] + "/";
		}

		File taskDirectory = new File( filePath + args[ 2 ] );

		System.out.println( "SingleFileReader.taskDirectory file size:" + taskDirectory.length() );
		// File taskDirectory = Helper.seekFile(args[2]);

		if (taskDirectory.isDirectory() && taskDirectory.listFiles() != null) {
			return taskDirectory.listFiles();
		}

		return null;
	}

}
